package com.xy.core.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;

import com.xy.gateway.model.EpayGateSetting;

public class FlowNo {/*

	private static String addZero(String sqlString, int Len) {
		SimpleDateFormat simpledateformat = new SimpleDateFormat(
				"yyyyMMddhhmmssSSS");
		String s = simpledateformat.format(new Date());
			String FF = s;
			for (int i = FF.length(); i < Len; i++)
				FF = "0" + FF;
			int i = FF.length();
			if (i > Len)
				FF = FF.substring(i - Len);
			return FF;
	}

	public static String getFlowNo() {
		return addZero("Select SEQ_ORDER_CREDIT.nextval From dual", 12);
	}

	public static String getFlowNo(String SysId)

	{
		return getFlowNo();

	}

	public static String getFixedFlowNo(int length) {

		return addZero("Select SEQ_ORDER_CREDIT.nextval From dual", length);

	}

	public static String getBankOrderFlow(app.gateway.model.Reqpara reqPara) {
		String fixedLength = reqPara.getLength();
		String maxLength = reqPara.getMaxlength();

		String date = ibsDate.getYYYYMMDD();
		if (fixedLength != null && !fixedLength.trim().equals("")) { 
			int intLength = Integer.parseInt(fixedLength);
			if (intLength >= 20) {
				return date + FlowNo.getFixedFlowNo(intLength - 8);
			} else if (intLength > 18) {
				return date.substring(2, 8)
						+ FlowNo.getFixedFlowNo(intLength - 6);
			} else if (intLength > 16) {
				return date.substring(4, 8)
						+ FlowNo.getFixedFlowNo(intLength - 4);
			} else { }

		} else { 
			int intMaxLength = Integer.parseInt(maxLength);
			if (intMaxLength > 20) {
				return date + FlowNo.getFixedFlowNo(12);
			} else if (intMaxLength > 18) {
				return date.substring(2, 8) + FlowNo.getFixedFlowNo(12);
			} else if (intMaxLength > 16) {
				return date.substring(4, 8) + FlowNo.getFixedFlowNo(12);
			} else {
				return "1" + FlowNo.getFixedFlowNo(intMaxLength - 1);
			}

		}
	}

	public static String getHostFlowNo() {
		return addZero("Select SEQ_CCB_CREDIT.nextval From dual", 11);
	}

	public static String getFixedHostFlowNo(int len) {
		return addZero("Select SEQ_CCB_CREDIT.nextval From dual", len);
	}
	
	*//**
	 * �������֧�����Ҫ����ɵĶ����ţ����͸�����	
	 * @param flowType
	 * @param USETHIRDPAY
	 * @return
	 *//*
	public static String getBankOrderFlow(String flowType,String USETHIRDPAY){
		String orderID = "";
		if("ChinaPay".equals(USETHIRDPAY)){
			orderID =FlowNo.getBankOrderFlow(EpayGateSetting.getReqParaOderByPK(flowType,"1","1")); 
		}else{
			orderID =FlowNo.getBankOrderFlow(EpayGateSetting.getReqParaOderByPK(flowType,"1","2"));	
		}
		return orderID;
	}

*/}
